package sword_to_1;

public class LeeCode_56_1 {
    public static void main(String[] args) {

    }
    private static int[] singleNumbers(int[] nums) {
        int tmp = 0;
        for (int num : nums) {
            tmp ^= num;
        }
        int div = 1;
        while ((div & tmp) == 0){
            div <<= 1;
        }
        int a = 0, b = 0;
        for (int num : nums) {
            if ((div & num) == 0){
                a ^= num;
            }else {
                b ^= num;
            }
        }
        return new int[]{a, b};
    }
}
